Skip to content

Content picker search with start node configured not taking user start nodes into account #19871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

lauraneto
Copy link
Contributor

Cherry pick of #19800 to V16 + adding new constructor without obsolete and unused parameters.

During testing I found that "Ignore user start nodes" is always false in the BackOfficeExamineSearcher.Search() method, even when it is set to true in the data type.
In V13 the data type id was provided in the search query, so that the setting could be retrieved, but that does not seem supported by the new search endpoint. Not sure if this should be looked at in this PR or as a different issue.

lauraneto and others added 2 commits August 6, 2025 15:06
…t nodes into account (#19800)

* Fix users being able to see nodes they don't have access to when using the picker search

* Readability and naming improvements

* Additional fixes

* Adjust tests

* Additional fixes

* Small improvement

* Replaced the root ids with constants

* Update src/Umbraco.Web.BackOffice/Trees/MemberTreeController.cs

Co-authored-by: Andy Butland <[email protected]>

---------

Co-authored-by: Andy Butland <[email protected]>
# Conflicts:
#	src/Umbraco.Examine.Lucene/BackOfficeExamineSearcher.cs
#	src/Umbraco.Web.BackOffice/Trees/ContentTreeController.cs
#	src/Umbraco.Web.BackOffice/Trees/MediaTreeController.cs
#	src/Umbraco.Web.BackOffice/Trees/MemberTreeController.cs
#	tests/Umbraco.Tests.Integration/Umbraco.Examine.Lucene/UmbracoExamine/BackOfficeExamineSearcherTests.cs
@lauraneto lauraneto marked this pull request as ready for review August 6, 2025 14:52
@Copilot Copilot AI review requested due to automatic review settings August 6, 2025 14:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR cherry-picks a fix from V16 and addresses an issue where the "Ignore user start nodes" setting in content picker search was not being properly respected. The fix refactors the path filtering logic to correctly handle user start nodes and search scope restrictions.

  • Refactors the AppendPath method to properly handle user start node permissions and search filtering
  • Simplifies constructor dependencies by removing unused parameters (IUmbracoMapper, IPublishedUrlProvider)
  • Updates test helper method to accept ignoreUserStartNodes parameter for better test coverage

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
BackOfficeExamineSearcher.cs Major refactoring of path filtering logic and constructor simplification with proper user start node handling
BackOfficeExamineSearcherTests.cs Updated test helper method to support configurable ignoreUserStartNodes parameter

@AndyButland
Copy link
Contributor

This looks good to me @lauraneto, but I think the issue you raised is worth fixing, at last on the server-side as part of this PR. I had a look into the code and think it's not too big an addition.

Looks like SearchDocumentItemController needs to take the additional parameter for the dataTypeId and inject the IDataTypeService.

You can then do:

bool ignoreUserStartNodes = dataTypeId.HasValue && _dataTypeService.IsDataTypeIgnoringUserStartNodes(dataTypeId.Value);

And pass the value into _indexedEntitySearchService.SearchAsync.

Will need the same on the SearchMediaItemController too.

For reference if you look at ChildrenDocumentTreeController you'll see we do similar for those requests.

Then of course we need to pass the data type Id from the client. I've not looked to see how easy that would be, but hopefully not too bad. If you can fix it too, please do - otherwise let's create an issue for someone else to look at.

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be working as expected in testing, so think we can merge this in now as it's resolved front-end and back-end. Good catch again and nice work.

I pushed one update that I believe should resolve the final breaking change that was being flagged with the controller methods. If that looks good to you and you don't have anything further to add, please feel free to merge.

@lauraneto lauraneto merged commit 417576b into main Aug 11, 2025
26 of 27 checks passed
@lauraneto lauraneto deleted the v16/bugfix/Content-picker-search-with-start-node-configured-not-taking-user-start-nodes-into-account branch August 11, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants